package app.htby.utils;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class RedisUtils {

	/** redis 大数据 连接ip port */
	public static String dataPlusIp = "localhost";
	public static Integer dataPlusPort = 6378;

	/** redis 本地系统 连接ip */
	public static String localIp = "localhost";
	public static Integer localPort = 6379;

	/** redis 大数据 分发 发送数据的key */
	public static String disDataPlusKey;
	/** redis 失败 发送数据的key */
	public static String localBadDataKey;

	/** redis 断线重连时间 */
	public static Integer reconnectTime = 3 * 1000;

	@Value("${redis.reconnectTime}")
	public void setReconnectTime(String reconnectTime) {
		RedisUtils.reconnectTime = Integer.parseInt(reconnectTime);
	}

	@Value("${redis.keys.localBadDataKey}")
	public void setLocalBadDataKey(String localBadDataKey) {
		RedisUtils.localBadDataKey = localBadDataKey;
	}

	@Value("${redis.keys.disDataPlusKey}")
	public void setDisDataPlusKey(String disDataPlusKey) {
		RedisUtils.disDataPlusKey = disDataPlusKey;
	}

	@Value("${redis.ports.dataPlusPort}")
	public void setDataPlusPort(String dataPlusPort) {
		RedisUtils.dataPlusPort = Integer.parseInt(dataPlusPort);
	}

	@Value("${redis.ports.localPort}")
	public void setLocalPort(String localPort) {
		RedisUtils.localPort = Integer.parseInt(localPort);
	}

	@Value("${redis.ips.dataPlusIp}")
	public void setDataPlusIp(String dataPlusIp) {
		RedisUtils.dataPlusIp = dataPlusIp;
	}

	@Value("${redis.ips.localIp}")
	public void setLocalIp(String localIp) {
		RedisUtils.localIp = localIp;
	}
}
